/*
 * Link.fx
 * Author: Yu Min-ting
 * Created on 2009-7-13, 13:49:55
 */

package com.sjtu.fx.others;

import javafx.scene.*;
import javafx.scene.effect.Reflection;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.scene.text.*;
import javafx.stage.Stage;
import com.sjtu.fx.tools.Panel;

public class Link extends CustomNode {
    var panel:Panel;

    var publicLink : Text = Text{
        content: "Public libraries"
        fill: Color.rgb(11,51,60)
         font: Font{ size:13 name: "Verdana Bold"}
         onMouseEntered: function( e: MouseEvent ):Void {
                 publicLink.fill =  Color.BLUE;
                 publicLink.effect = Reflection {
                fraction: 0.75
                topOffset:-1.0
            }
             }
         onMouseExited: function(e:MouseEvent) {
                publicLink.fill = Color.rgb(11,51,60);
                publicLink.effect = null;
        }
        onMouseClicked: function( e: MouseEvent ):Void {

        }
    }

    var researchLink : Text = Text{
         content: "Research Libraries"
        fill: Color.rgb(11,51,60)
         font: Font{ size:13 name: "Verdana Bold"}

         onMouseEntered: function( e: MouseEvent ):Void {
                researchLink.fill =  Color.BLUE;
                researchLink.effect = Reflection {
                fraction: 0.75
                topOffset:-1.0
            }
             }
         onMouseExited: function(e:MouseEvent) {
                researchLink.fill = Color.rgb(11,51,60);
                researchLink.effect = null;
        }
        onMouseClicked: function( e: MouseEvent ):Void {

        }
    }
    var schoolLink : Text = Text{
         content: "School Libraries"
        fill: Color.rgb(11,51,60)
         font: Font{ size:13 name: "Verdana Bold"}
         x: 145 y: 185

         onMouseEntered: function( e: MouseEvent ):Void {
                schoolLink.fill =  Color.BLUE;
                schoolLink.effect = Reflection {
                fraction: 0.75
                topOffset:-1.0
            }
             }
         onMouseExited: function(e:MouseEvent) {
                 schoolLink.fill = Color.rgb(11,51,60);
                 schoolLink.effect = null;
        }
        onMouseClicked: function( e: MouseEvent ):Void {

        }
    }

    var overseaLink : Text = Text{
         content: "Overseas Libraries"
        fill: Color.rgb(11,51,60)
         font: Font{ size:13 name: "Verdana Bold"}
         x: 145 y: 185

         onMouseEntered: function( e: MouseEvent ):Void {
                overseaLink.fill =  Color.BLUE;
                overseaLink.effect = Reflection {
                fraction: 0.75
                topOffset:-1.0
            }
             }
         onMouseExited: function(e:MouseEvent) {
                overseaLink.fill = Color.rgb(11,51,60);
                overseaLink.effect = null;
        }
        onMouseClicked: function( e: MouseEvent ):Void {
        }
    }

    override protected function create() : Node {
        Group{
            content:[
                 panel = Panel {
                    width:    290
                    height:   240
                    title:    "Link to Other Libraries"
                    translateX: 0
                    translateY: 0
                },

                 VBox{
                    spacing: 20
                    translateX:40 translateY: 50
                    content:[publicLink, researchLink, schoolLink, overseaLink]
                },

            ]
        }
     }

function run() {
    Stage {
       width: 350 height: 300
        scene: Scene {
            content: [
                Link {translateX: 40 translateY: 40}
            ]
        }
    }
}


}
